package com.itkaien.service.impl;

import com.itkaien.service.UserDao;
import com.itkaien.service.UserService;
import org.springframework.beans.factory.InitializingBean;

public class UserServiceimpl implements UserService, InitializingBean {
    private String username;
    private String password;

    private UserDao userDao;


    public UserServiceimpl() {
    }

    public UserServiceimpl(String username, String password) {
        this.username = username;
        this.password = password;
    }
    public  void init() {
        System.out.println("初始化");
    }
    public void destroy() {
        System.out.println("销毁");
    }

    public static UserDao getUserDaoImpl(){

        return new UserDaoImpl();
    }
    public  UserDao getUserDaoImplcommon(){

        return new UserDaoImpl();
    }
    public  UserDao getUserDaoImplcommonArg(String username, String password){
        this.username = username;
        this.password = password;
        return new UserDaoImpl();
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;

    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("初始化方法afterPropertiesSet");
    }
}
